import pandas as pd
import random

bookdata=pd.read_csv('../dataset/book/book.csv')

def marge(bookdata):
    bookid=[]
    bookstock=[]
    booklocation=[]

    for i in range(len(bookdata)):
        item=bookdata.loc[i]
        for j in range(random.randint(1,3)):
            bookid.append(item[1])
            bookstock.append(random.randint(0,10))
            booklocation.append(str(random.randint(1,4))+"楼"+str(random.randint(1,16))+"书架")


    df=pd.DataFrame({'book_id':bookid,'book_stock':bookstock,'book_location':booklocation})
    return df

if __name__ == '__main__':
    marge(bookdata).to_csv('../dataset/book/stock.csv')